package net.moonbiter.ebs;

import java.util.Map;
import java.util.HashMap;
import java.util.Set;

public class ServiceProviderDef {
	private Map<String,ServiceDef> services;
	
	public ServiceProviderDef(){
		services = new HashMap<String,ServiceDef>();
	}
	
	public void add(String name,ServiceDef srvc){
		services.put(name, srvc);
	}
	
	public boolean hasService(String serviceName){
		return services.containsKey(serviceName);
	}
	
	public ServiceDef getService(String serviceName){
		if (!hasService(serviceName)){
			throw new IllegalArgumentException("Unknown service \""
					+serviceName+"\"");
		}
		return services.get(serviceName);
	}
	
	public Set<String> getServicesNames(){
		return services.keySet();
	}
}
